<%@ page contentType="text/html; charset=UTF-8" import="org.apache.tomcat.dbcp.dbcp.*,java.util.*,javax.naming.*,javax.sql.*,java.sql.*,java.text.*"%>
<%
   //ResourceBundle rbdDBConfig=ResourceBundle.getBundle("WEB_Config",Locale.getDefault());
        Connection conn = null;
        BasicDataSource bds=null;
        boolean blnPool=false;
        int intActive=0;
        int intIdle=0;

        try {
            Context ctx = new InitialContext();
            Context envContext = (Context) ctx.lookup("java:/comp/env");
            DataSource ds = (DataSource) envContext.lookup("NPIDB_NPI");
            bds = (BasicDataSource)envContext.lookup("NPIDB_NPI");

            conn = ds.getConnection();

            blnPool=(conn!=null);

            if(blnPool){
              intActive=bds.getNumActive();
              intIdle=bds.getNumIdle();


            }

        } catch (Exception ex) {
            System.out.println(this.toString().substring(this.toString().lastIndexOf('.') + 1,this.toString().lastIndexOf('@')) + ".java" +  " (getConn) Exception --> " + ex.toString());
        }
        finally{
          try{conn.close();}catch(Exception e){}
        }
 %>
<html>
<head>
<title>
TestConnPool
</title>
<meta http-equiv="refresh" content="5">
</head>
<body bgcolor="#ffffff">
<%
	SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
    java.util.Date dteNOW = new java.util.Date();
	out.print(formatter.format(dteNOW).toString());
%>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<%if("NPIDB_NPI"!=null && !"NPIDB_NPI".trim().equals("")){ %>
  <%if(blnPool){out.print("NPIDB_NPI" + " use Connection Pool Successful,   ");
  out.print("Active Num:" + intActive + "    ||      ");
  out.print("Idle Num:" + intIdle);}
  %>
  <%if(!blnPool){out.println("NPIDB_NPI" + " use Connection Pool fail");} %>
<%}else{out.println("DB_Config havn't LOOKUP_NAME");}%>
</body>
</html>
